<HTML>
<HEAD>
<TITLE>
Buffer.h
</TITLE>
</HEAD>
<BODY>
<PRE>
<font color="blue">#ifndef</font> BUFFER_H_
<font color="blue">#define</font> BUFFER_H_

<font color="blue">#include</font> <font color="maroon">&#60;stdio.h&#62;</font> 
<font color="blue">#include</font> <font color="maroon">&#60;stdlib.h&#62;</font>
<font color="blue">#include</font> <font color="maroon">&#60;vector&#62;</font> 
<font color="blue">#include</font> <font color="maroon">"../exceptions/IllegalOperation.h"</font>
<font color="blue">#include</font> <font color="maroon">"../exceptions/MemoryStorageException.h"</font>
<font color="blue">#include</font> <font color="maroon">"../exceptions/NullPointerException.h"</font>
<font color="green">/**
 * 
 * Esta clase es un singleton
 * 
 * Existe un unico buffer
 * 
 * 
 * */</font>
<font color="blue">class</font> Buffer <font color="black">{</font>

<font color="blue">private</font><font color="black">:</font>
    <font color="blue">unsigned</font> <font color="blue">int</font> tamanio;
    <font color="blue">void</font> <font color="black">*</font>pointer;
    <font color="blue">unsigned</font> <font color="blue">int</font> offset; <font color="green">// ver si es necesario</font>
    
    vector<font color="black">&#60;</font><font color="blue">unsigned</font> <font color="blue">int</font><font color="black">&#62;</font><font color="black">*</font> ListEspaciosLibres;

    Buffer<font color="black">(</font><font color="black">)</font>;
    <font color="blue">static</font> Buffer <font color="black">*</font>instancia;
    
<font color="blue">public</font><font color="black">:</font>
    
    
    virtual ~Buffer<font color="black">(</font><font color="black">)</font>;
        
    <font color="blue">static</font> Buffer<font color="black">*</font> getInstance<font color="black">(</font><font color="black">)</font>;   
        
    <font color="blue">unsigned</font> <font color="blue">int</font> getTamanio<font color="black">(</font><font color="black">)</font>;
    
    <font color="green">/***
     * solo una vez al comenzar la ejecucion, no permiteo redimensionarlo.
     *  
     */</font>
    <font color="blue">void</font> setTamanio<font color="black">(</font><font color="blue">unsigned</font> <font color="blue">int</font> tam<font color="black">)</font>;
    
    <font color="blue">void</font><font color="black">*</font> getPointer<font color="black">(</font><font color="black">)</font>;
    
    vector<font color="black">&#60;</font><font color="blue">unsigned</font> <font color="blue">int</font><font color="black">&#62;</font><font color="black">*</font> getListEspaciosLibres<font color="black">(</font><font color="black">)</font>;
    
    <font color="blue">static</font> <font color="blue">const</font> <font color="blue">unsigned</font> <font color="blue">int</font> tamanioBloque <font color="black">=</font> <font color="maroon">128</font>; 
    
<font color="black">}</font>;

<font color="blue">#endif</font> <font color="green">/* BUFFER_H_ */</font>

</PRE>
</BODY>
</HTML>
